using System.Collections.Generic;
using Microsoft.MediaCenter.Hosting;
using OpenMCPL.MediaCenter;
using System;
using OpenMCPL.MediaCenter.Code;

namespace OpenMCPL.MediaCenter.Example
{
    public class MyAddIn : IAddInModule, IAddInEntryPoint
    {
        private static OpenMCPL.MediaCenter.Code.HistoryOrientedPageSessionEx session;

        public void Initialize(Dictionary<string, object> appInfo, Dictionary<string, object> entryPointInfo)
        {
        }

        public void Uninitialize()
        {
        }

        public void Launch(AddInHost host)
        {
            AssemblyResolver.MakeCustomAssembliesWellknown();
            //StaticSingleton<AddInHost> test=StaticSingleton<AddInHost>.
            //session = new HistoryOrientedPageSessionEx();// (VirtualApplication.Instance);
            session.GoToPageWithoutHistory("resx://OpenMCPL.MediaCenter/OpenMCPL.MediaCenter.Resources/Loader", new Dictionary<string, object>());
            ////session.GoToPage("resx://OpenMCPL.MediaCenter.Example/OpenMCPL.MediaCenter.Example.Resources/Default");
            //Microsoft.MediaCenter.UI.Application.DeferredInvoke(new Microsoft.MediaCenter.UI.DeferredHandler(this.BeginStart), (object)host, new TimeSpan(100));
        }

        private void BeginStart(object host)
        {
            session.GoToPage("resx://OpenMCPL.MediaCenter.Example/OpenMCPL.MediaCenter.Example.Resources/Default");
        }
    }
}